﻿// -----------------------------------------------------------------------
// <copyright file="Singleton.cs" company="FCIS">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace FaceRecognition.Models
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using FaceRecognition.DataBase;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Singleton
    {
        private static Singleton instance;
        private static int userID;
        private static string userEmail;
        private static Image userImg;
        private static Account[] accounts;
        private static List<string> features;
        private static Users_Info user;
        private  static User_Manager Obj_UserManager;
        private Singleton()
        {
            features = new List<string>();
            user = new Users_Info();
            Obj_UserManager = new User_Manager();
        }

        public static void Set_Info(string email , List<string> features_temp)
        {       
            user.email = email;
            features = features_temp;
            Get_ID();
        }

        public static int Get_ID()
        {
            userID = Obj_UserManager.ID_retrival_by_email(user.email);
            return userID;
        }
        public static string Get_Email()
        {
            return user.email;
        }


        public static List<string> Get_Features()
        {
            return features;
        }

        public static Singleton Get_Instance()
        {
            if (instance == null)
            {
                instance = new Singleton();
            }

            return instance;
        }
        
        public static void End_Session()
        {
            instance = null;
        }
    }
}
